package com.yc.autouser.entity.vo;

import com.yc.autouser.entity.SysUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class LoginUserVo implements UserDetails {
    private SysUser sysUser;

    @Override// 表示获取登录用户所有权限
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override// 表示获取密码
    public String getPassword() {
        return sysUser.getPassword();
    }

    @Override// 表示获取用户名
    public String getUsername() {
        return sysUser.getUsername();
    }

    @Override// 表示判断账户是否过期
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override// 表示判断账户是否被锁定
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override// 表示凭证{密码}是否过期
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override// 表示当前用户是否可用
    public boolean isEnabled() {
        return true;
    }

}
